<%@page 
	import="java.util.*" 
	import="java.util.Date"
	import="java.text.DateFormat"
	import="java.text.SimpleDateFormat"
	import="java.util.Calendar"
%>
<%@page
	import="Model.*"

%>
<%@page
	import="POJO.*"

%>
<% String id = (String)request.getAttribute("id"); 
	CustomerPOJO user = null;	

	if(id != null)
	{
		user  = CustomerModel.selectCustomerByID(id);
	}
	
%>
<!-- start content-outer -->
<div id="content-outer">
	<!-- start content -->
	<div id="content">


		<div id="page-heading">
			<h1><% if(user!=null){out.print("Update Customer");}else{out.print("Add Customer");} %></h1>
		</div>

		<form action="customer" method="post">
			<table border="0" width="100%" cellpadding="0" cellspacing="0"
				id="content-table">
				<tr>
					<th rowspan="3" class="sized"><img
						src="images/shared/side_shadowleft.jpg" width="20" height="300"
						alt="" /></th>
					<th class="topleft"></th>
					<td id="tbl-border-top">&nbsp;</td>
					<th class="topright"></th>
					<th rowspan="3" class="sized"><img
						src="images/shared/side_shadowright.jpg" width="20" height="300"
						alt="" /></th>
				</tr>
				<tr>
					<td id="tbl-border-left"></td>
					<td>
						<!--  start content-table-inner -->
						<div id="content-table-inner">


							<table border="0" width="100%" cellpadding="0" cellspacing="0">
								<tr valign="top">
									<td>
										<!-- start id-form -->
										<table border="0" cellpadding="0" cellspacing="0" id="id-form">
											<tr>
												<th valign="top">Your name:</th>
												<td><input name="txtname" type="text" class="inp-form" value="<%if(user != null) out.print(user.GetName()); %>"/></td>
												<td></td>
											</tr>
											<tr>
												<th valign="top">Address</th>
												<td><input name="txtAddress" type="text" value="<%if(user != null) out.print(user.GetAddress()); %>"
													class="inp-form" /></td>

											</tr>
										
											<tr>
												<th valign="top">Select a date:</th>
												<td class="noheight">

													<table border="0" cellpadding="0" cellspacing="0">
														<tr valign="top">
															<td>
																	<select name="d" class="styledselect-day">
																	<%
		
																		for(int i=1;i<=31;i++)
																		{
																	%>
																		<option value=<%= i %>	
																			
																		
																		 ><%= i %></option>
																		<%} %>
																	</select>
															</td>
															<td>
															<select name="m" class="styledselect-month">	
																	<%
																		for(int i=1;i<=12;i++)
																		{
																	%>
																	<option value=<%= i %>><%= i %></option>
																		<%} %>
															</select>
															</td>
															<td>
															<select name="y" class="styledselect-year">
																	<%
																		DateFormat dateFormat = new SimpleDateFormat("yyyy");
																		Date year=new Date();
																		for(int i=1900;i <= Integer.parseInt((dateFormat.format(year)));i++)
																		{
																	%>
																	<option value=<%= i %>><%= i %></option>
																		<%} %>
															</select>
															</td> 														
														</tr>
													</table>

												</td>
												<td></td>
											</tr>
											<tr>
												<th valign="top">Telephone</th>
												<td><input name="txtTelephone" type="text" value="<%if(user != null) out.print(user.GetTel()); %>"
													class="inp-form" /></td>
											</tr>
											<tr>
												<th valign="top">Sex</th>
												<td><select name="sex">

														<option value="Male">Male</option>
														<option value="Female">Female</option>
												</select></td>
											</tr>
											<tr>
												<td>
													<input type="hidden" value="<%if(user!=null) {out.print("Edit");}else{out.print("Add");}%>" name="do"/>
													<input type="hidden" value="<%if(user!=null) out.print(user.GetID()); %>" name="idedit"/>
												</td>
												<th>&nbsp;</th>
												<td valign="top"><input type="submit" value="Submit"  class="form-submit"
													name="btnSubMit"> <input type="reset" value="Reset" class="form-reset"
													name="btnReset"></td>
												<td></td>
											</tr>
										</table> <!-- end id-form  -->

									</td>

								</tr>
								<tr>
									<td><img src="images/shared/blank.gif" width="695"
										height="1" alt="blank" /></td>
									<td></td>
								</tr>
							</table>

							<div class="clear"></div>
						</div> <!--  end content-table-inner  -->
					</td>
					<td id="tbl-border-right"></td>
				</tr>
				<tr>
					<th class="sized bottomleft"></th>
					<td id="tbl-border-bottom">&nbsp;</td>
					<th class="sized bottomright"></th>
				</tr>
			</table>
		</form>



		<div class="clear">&nbsp;</div>

	</div>
	<!--  end content -->
	<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer -->